/*
 *    Copyright (c) 2018-2025, proj All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the proj developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: proj
 */

package com.ykht.proj.coupon.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ykht.proj.coupon.entity.CnBrand;
import com.ykht.proj.coupon.entity.CnCoupon;
import com.ykht.proj.coupon.entity.CnShop;
import com.ykht.proj.coupon.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;

/**
 * 优惠券表
 *
 * @author proj code generator
 * @date 2020-11-16 17:00:20
 */
@Mapper
public interface CnCouponMapper extends BaseMapper<CnCoupon> {

	List<CnCouponVo> findPage(Page page, @Param("map") CnCouponVo cnCouponVo);

	List<ShopHasCouponCount> shopHasCouponCount(@Param("list") Collection<Long> c);

	List<RecommendCouponVo> recommendCouponList(@Param("list") List<CnBrand> brandList, @Param("shop") CnShop cnShop);

	/**
	 * 根据品牌ID获取 领劵中心列表
	 *
	 * @param brandIdList 品牌ID集合
	 * @param userId      登录人ID
	 * @return
	 */
	List<CnCouponDetailResp> getCouponList(@Param("brandIdList") List<Long> brandIdList, @Param("userId") Long userId);

	/**
	 * 获取符合条件的品牌
	 *
	 * @return
	 */
	List<CnCoupon> getBrandId();

	/**
	 * 获取符合条件的品牌 列表的下拉
	 *
	 * @param ids
	 * @return
	 */
	List<CnCoupon> getBrandIdPage(@Param("ids") List<Long> ids);

	/**
	 * 根据品牌ID获取 领劵中心列表的下拉
	 *
	 * @param brandIdList 品牌ID集合
	 * @param ids         已有的优惠券ID
	 * @param userId      登录人ID
	 * @return
	 */
	List<CnCouponDetailResp> getCouponListPage(@Param("brandIdList") List<Long> brandIdList,
											   @Param("ids") List<Long> ids, @Param("userId") Long userId);

	/**
	 * 获取全部 爆款优惠 指定的数量
	 *
	 * @param number 获取几条数量
	 * @param userId 登录人ID
	 * @return
	 */
	List<CnCouponDetailResp> getLoginWholeHotCouponList(@Param("number") Integer number,@Param("brandIdList") List<Long> brandIdList, @Param("userId") Long userId,@Param("ids") List<Long> ids);

	/**
	 * 没有登录的 获取全部 爆款优惠 指定的数量
	 *
	 * @param number 获取几条数量
	 * @return
	 */
	List<CnCouponDetailResp> getWholeHotCouponList(@Param("number") Integer number);


	List<CnCouponReceiveVo> couponListByShopIdAndBrandId(@Param("shopId") Long id, @Param("brandId") Long brandId);

    List<CnCouponVo> getCouponByShopName(@Param("cnCouponVo")CnCouponVo cnCouponVo);

	@SqlParser(filter=true)
	Page<WqqfCouponVo> wqqf(Page page,@Param("req") WqqfCoupon req);

//	Page<WqqfCouponVo> wqqfDiscount(Page page,@Param("req")WqqfCoupon req);

//	Page<WqqfCouponVo> wqqfUse(Page page,@Param("req")WqqfCoupon req);
}
